﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using FreeSql.DataAnnotations;

namespace Admin.Core.Common.BaseModel
{
    /// <summary>
    /// 实体创建审计
    /// </summary>
    public class EntityAdd<TKey> : Entity<TKey>, IEntityTenant,IEntityAdd<TKey> where TKey : struct
    {

        /// <summary>
        /// 租户
        /// </summary>
        [Description("租户")]
        [Column(Position = -4, CanUpdate = false,Name = "TENANTID")]
        public int TenantId { get; set; }

        /// <summary>
        /// 创建者Id
        /// </summary>
        [Description("创建者Id")]
        [Column(Position = -3, CanUpdate = false, Name = "CREATEDUSERID")]
        public TKey? CreatedUserId { get; set; }

        /// <summary>
        /// 创建者
        /// </summary>
        [Description("创建者")]
        [Column(Position = -2, CanUpdate = false, Name = "CREATEDUSERNAME"), MaxLength(50)]
        public string CreatedUserName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Description("创建时间")]
        [Column(Position = -1, CanUpdate = false, ServerTime = DateTimeKind.Local, Name = "CREATEDTIME")]
        public DateTime? CreatedTime { get; set; }
    }

    public class EntityAdd : EntityAdd<long>
    {

    }


    /// <summary>
    /// 实体创建审计
    /// </summary>
    public class EntityNTAdd<TKey> : Entity<TKey>, IEntityAdd<TKey> where TKey : struct
    {

        /// <summary>
        /// 创建者Id
        /// </summary>
        [Description("创建者Id")]
        [Column(Position = -3, CanUpdate = false, Name = "CREATEDUSERID")]
        public TKey? CreatedUserId { get; set; }

        /// <summary>
        /// 创建者
        /// </summary>
        [Description("创建者")]
        [Column(Position = -2, CanUpdate = false, Name = "CREATEDUSERNAME"), MaxLength(50)]
        public string CreatedUserName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Description("创建时间")]
        [Column(Position = -1, CanUpdate = false, ServerTime = DateTimeKind.Local, Name = "CREATEDTIME")]
        public DateTime? CreatedTime { get; set; }
    }

    public class EntityNTAdd : EntityNTAdd<long>
    {

    }
}
